home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UUPC11QS.ARJ / UUCICO.C < prev    next >
C/C++ Source or Header  |  1991-11-21  |  3KB  |  111 lines

  1. /*
  2.  * History:4,1
  3.  * Mon May 15 19:56:44 1989 Add c_break handler                   ahd
  4.  * 20 Sep 1989 Add check for SYSDEBUG in MS-DOS environment       ahd
  5.  * 22 Sep 1989 Delete kermit and password environment
  6.  *             variables (now in password file).                  ahd
  7.  * 30 Apr 1990  Add autoedit support for sending mail              ahd
  8.  *  2 May 1990  Allow set of booleans options via options=         ahd
  9.  * 29 Jul 1990  Change mapping of UNIX to MS-DOS file names        ahd
  10.  */
  11.  
  12. /*
  13.    ibmpc/host.c
  14.  
  15.    IBM-PC host program
  16. */
  17.  
  18. #include <dos.h>
  19. #include <setjmp.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <time.h>
  24.  
  25. #include "lib.h"
  26. #include "dcp.h"
  27. #include "hlib.h"
  28. #include "hostable.h"
  29. #include "security.h"
  30. #include "modem.h"
  31. #include "pushpop.h"
  32. #include "timestmp.h"
  33. #include "ulib.h"
  34.  
  35. currentfile();
  36.  
  37. int c_break( void );
  38.  
  39. jmp_buf  dcpexit;
  40.  
  41. void main( int argc, char *argv[])
  42. {
  43.    int status;
  44.  
  45. /*--------------------------------------------------------------------*/
  46. /*          Report our version number and date/time compiled          */
  47. /*--------------------------------------------------------------------*/
  48.  
  49.    banner( argv );
  50.  
  51. #if defined(__CORE__)
  52.    copywrong = strdup(copyright);
  53.    checkref(copywrong);
  54. #endif
  55.  
  56.    if (!configure( B_UUIO ))
  57.       panic();
  58.  
  59. /*--------------------------------------------------------------------*/
  60. /*                        Trap control C exits                        */
  61. /*--------------------------------------------------------------------*/
  62.  
  63. #ifdef __TURBOC__
  64.    ctrlbrk(c_break);
  65. #endif
  66.  
  67.    printmsg(3,"main: Control C handler set");
  68.  
  69.    if (getenv("TZ") == NULL )
  70.    {
  71.       printmsg(0,"Environment variable TZ must be set!");
  72.       panic();
  73.    }
  74.    tzset();                      /* Set up time zone information  */
  75.  
  76.    PushDir(spooldir);
  77.    atexit( PopDir );
  78.  
  79. /*--------------------------------------------------------------------*/
  80. /*                   setup longjmp for error exit's                   */
  81. /*--------------------------------------------------------------------*/
  82.  
  83.    status = 10;   /* set default in case we get out via a longjmp */
  84.  
  85.    if (setjmp(dcpexit) == 0)
  86.       status = dcpmain(argc, argv);
  87.  
  88.    exit( status );
  89. } /*main*/
  90.  
  91. #ifdef __TURBOC__
  92. /*--------------------------------------------------------------------*/
  93. /*   c_break   -- control break handler to allow graceful shutdown    */
  94. /*                    of interrupt handlers, etc.                     */
  95. /*--------------------------------------------------------------------*/
  96.  
  97. int c_break( void )
  98. {
  99.    printmsg(0,"c_break: program aborted by user Ctrl-Break");
  100.  
  101.    if (port_active == TRUE)
  102.       shutdown();
  103.  
  104.    fcloseall();
  105.  
  106.    exit(100);              /* Allow program to abort              */
  107.    return(0);              /* Abort (never reached)               */
  108.  
  109. } /* c_break */
  110. #endif
  111.